from db_DoctorManager import DoctorManager

class DoctorSystem:
    def __init__(self):
        """
        康复系统核心后端（修正版）
        移除循环引用，简化初始化流程
        初始化子模块（注意：不再递归创建实例）
        初始化缓存
        """
        self.doctor_manager=DoctorManager()

    def get_available_therapists(self, doctor_id):
        """
        获取可分配的治疗师列表（未分配给当前医生的治疗师）
        :param doctor_id: 当前医生的ID
        :return: 可分配治疗师列表
        """
        return self.doctor_manager.get_available_therapists(doctor_id)

    def add_therapist(self, name, specialty, license_number):
        return self.doctor_manager.create_therapist(name, specialty, license_number)

    def modify_therapist(self, therapist_id, **kwargs):
        return self.doctor_manager.update_therapist(therapist_id, **kwargs)

    def remove_therapist(self, therapist_id):
        return self.doctor_manager.delete_therapist(therapist_id)

    def get_patient_list(self, therapist_id=None):
        return self.doctor_manager.list_patients(therapist_id)

    def add_patient(self, name, gender, birth_date, medical_history=None, therapist_id=None):
        return self.doctor_manager.create_patient(name, gender, birth_date, medical_history, therapist_id)

    def assign_patients(self, patient_ids, therapist_id):
        return self.doctor_manager.assign_therapist(patient_ids, therapist_id)

    def update_patient(self, patient_id, **kwargs):
        return self.doctor_manager.update_patient(patient_id, **kwargs)

    def assign_therapist_to_doctor(self, doctor_id, therapist_id):
        return self.doctor_manager.assign_therapist_to_doctor(doctor_id,therapist_id)

    def save_new_patient(self, patient_data):
        return  self.doctor_manager.save_new_patient(self, patient_data)
